﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Clients_genCheck : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            panel_Sek.Visible = true;
            panel_Potvrzeni.Visible = false;
        }
    }
    protected void cmd_GenerujSek_Click(object sender, EventArgs e)
    {

        // zavolat funkci do AccontManager -> generuj šek, vrati Guid
        Guid guid = PaymentManager.saveCheck(Context.User.Identity.Name, txt_Komu.Text, txt_Castka.Text, date_Splatnost.SelectedDate.ToString(), txt_Komentar.Text);

        if (guid != Guid.Empty)
        {
            lbl_VysledekSeku.Text = "Šek byl uspešne vygenerovan ";
            lbl_VysledekSeku.ForeColor = System.Drawing.Color.Green;
            txt_Guid.Text = guid.ToString();//dodat guid z vracenehoi objektu
            txt_Guid.Visible = true;
        }
        else
        {
            lbl_VysledekSeku.Text = "Šek se nepodařilo vygenerovat";
            lbl_VysledekSeku.ForeColor = System.Drawing.Color.Red;
            txt_Guid.Visible = false;
        }
        panel_Sek.Visible = false;
        panel_Potvrzeni.Visible = true;
    }
}
